#ifndef TUPLE_H
#define TUPLE_H

template <typename... Values> class tuple;
template<> class tuple<>{};

template <typename Head, typename... Tail>
class tuple<Head, Tail...>
        :private tuple<Tail...>
{
    typedef tuple<Tail...> inherited;
public:
    tuple(){}
    tuple(Head v, Tail... vtail)
        : m_head(v), inherited(vtail...){}

    typename Head::type head() { return m_head;}
    inherited& tail() { return *this;}//return  后，转型为 inherited ,实际获得的是 Tail...

protected:
    Head m_head;
};


template <typename _Tp>
struct remove_const {
    typedef _Tp type;
};

template <typename _Tp>
struct remove_const<const _Tp> {
    typedef _Tp type;
};

template <typename _Tp>
struct remove_volatile {
    typedef _Tp type;
};

template <typename _Tp>
struct remove_volatile<volatile _Tp> {
    typedef _Tp type;
};

/*
 * 将传入的`const  volatile Type` 去掉 const 和 volatile ，还原原始的类型
 */
template <typename _Tp>
struct remove_cv{
    typedef typename remove_const<typename remove_volatile<_Tp>::type>::type type;
};

template<typename>
struct __is_void_helper
        :public false_type{};

template<typename>
struct __is_void_helper<void>:
        public true_type{};

template <typename _Tp>
struct is_void :
        public __is_void_helper<typename remove_cv<_Tp>::type>::type {};

#endif // TUPLE_H
